package com.yangfan.springcloud.service;

import com.yangfan.springcloud.entities.CommonResult;
import com.yangfan.springcloud.entities.Payment;
import feign.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @description: OpenFeign 只需要写一个借口 还有注解皆可以访问了
 * @author: yangfan
 * @date: Created in 2020/4/20 0020 15:19
 * @modified By:
 */

@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface PaymentService {

    @PostMapping(value = "/payment/create")
    CommonResult<Payment> create (@RequestBody Payment payment);

    @GetMapping(value = "/payment/getPaymentById/{id}")
    CommonResult getPaymentById(@PathVariable(value = "id") Long id);


    @GetMapping(value = "/payment/timeout")
    CommonResult timeout();

}
